/**
 * 诊疗人次(一年内)--折线图
 */
(function() {
	'use strict';
	require(['orange','c','easing'], function(orange,c) {
		
		getNav();
		function getNav() {
			var navData = [{key: '概况', name: ['概况'], value: []},
			       {key: '诊疗', 
			    	name: ["全省诊疗人次", "常见病", "处方总数", "辨证论治开方数", "远程会诊人次", "中医体质测评人次"], 
			    	value:["684", "5", "12821", "80", "90", "200"]},
			       {key: '健康平台', name: ["健康信息平台在线人数"], value:["540"]},
			       {key: '资源数据', name: ["资源数据"], value:[]},
			       {key: '信息化', name: ["中医馆信息化", "中医馆所在单位信息化", "中医馆所在单位网络"], value:[]}
			    ];
			$('#inner_right_nav').empty().append('<ul class="container"></ul>');
			var oUls = $('#inner_right_nav .container'),classColor = ['red','orange','yellow','blue','green'];
			for(var i=0; i<navData.length; i++) {
				var key = navData[i].key,
					name = navData[i].name,
					value = navData[i].value;
				var lis = '<li class="menu"><ul>';
				lis += '<li class="button"><a href="#" class="'+classColor[i]+'">' + key + '<span></span></a></li><li class="dropdown"><ul>';
				for(var j=0; j<name.length; j++) {
					lis += '<li><a>' + name[j] + '<span>' + (value[j]?value[j]:"") + '</span></a></li>';
				}
				lis += '</ul></li></ul></li>'; 
				oUls.append(lis);
			}
		}
		
		function rank(url, name) {
			if(url!=''){
				$('#tcm_right_div_1').empty().append('<div class="news-wapper" id="news_vscroller"></div>');
				$('#news_vscroller').vscroller({ url:url ,title: name});
			}
		}
		
		function title(title,nums) {
			$('.tcm-brand-title').html(title+":");
			orange.titleBrand(nums,'tcm_brand_num');
		}
		
		function emptyProgress(){		//清空实施进度
			if($('#tcm_progress_div').length>0){
				$('#tcm_progress_div').empty();
			}
		}
		
		function getUrl(aText) {
			var _url = "";
			switch(aText) {
				case "全省诊疗人次":	 //诊疗情况
					_url = 'resources/data/clinic.xml';
					break;
				case "常见病":	//常见病
					_url = '';
					break;	
				case "处方总数":
					_url = 'resources/data/presDrug.xml';
					break;
				case "处方费用":
					_url = 'resources/data/presFee.xml';
					break;
				case "辨证论治开方数":
					_url = 'resources/data/prescri.xml';
					break;
				case "远程会诊人次":
					_url = 'resources/data/num.xml';
					break;
				case "中医体质测评人次":	
					_url = 'resources/data/num.xml';
					break;
				case "健康信息平台在线人数":	//健康信息平台在线人数
					_url = 'resources/data/docRank.xml';
					break;
				case "电脑":		//信息化
					_url = 'resources/data/computer.xml';
					break;
				case "医生工作站":
					_url = 'resources/data/docWorkStation.xml';
					break;
				case "网络":
					_url = 'resources/data/computer.xml';
					break;
				case "摄像头":
					_url = 'resources/data/camera.xml';
					break;
				case "资源数据":
					_url = '';
					break;
				case "中医特色":
					_url = 'resources/data/computer.xml';
					break;
				case "信息化培训":
					_url = 'resources/data/train.xml';
					break;
				case "医院信息化":
					_url = 'resources/data/hospInfo.xml';
					break;
				case "HIS":
					_url = 'resources/data/his.xml';
					break;
				case "中医馆信息化":
					_url = 'resources/data/tcmMuseum.xml';
					break;
				case "中医馆所在单位网络":
					_url = 'resources/data/tcmMuseum.xml';
					break;
				default:
					_url = '';
			}
			return _url;
		}
		
		function leftDiv(text, c, aText) {
			function draw1(w, title) {
				$('#tcm_left_div_1').empty().append('<div id="cWrapper1"><h3 class="tcm-title"></h3><div id="c1"></div></div>');
				$('#cWrapper1 .tcm-title').html(title);
				$('#cWrapper1').css({'height':w*0.63});
				$('#c1').css({'width':w,'height':w*0.6});
			}
			function draw2(w, title) {
				$('#tcm_left_div_2').empty().append('<div id="cWrapper2"><h3 class="tcm-title"></h3><div id="c2"></div></div>');
				$('#cWrapper2 .tcm-title').html(title);
				$('#cWrapper2').css({'height':w*0.63});
				$('#c2').css({'width':w,'height':w*0.6});
			}
			function draw3(w, title) {
				$('#tcm_left_div_3').empty().append('<div id="cWrapper3"><h3 class="tcm-title"></h3><div id="c3"></div></div>');
				$('#cWrapper3 .tcm-title').html(title);
				$('#cWrapper3').css({'height':w*0.63});
				$('#c3').css({'width':w,'height':w*0.6});
			}
			var w = Math.floor(document.getElementById('tcm_left_div_1').clientWidth);
			switch(aText) {
				case "全省诊疗人次":
					var options1 = {
						seriesName: '全省诊疗人次',
						seriesData:[
				                {value:112202760, name:'中成药'},
				                {value:34683454, name:'中药'},
				                {value:179047119, name:'西药'} 
				            ],
				        chartWrapperId: 'c1'
					};
					draw1(w, "医生人数及诊疗人次");
					c.barAndLine(options1);
					
					var seriesData1 = [[25, '医师'], [47, '主任医师'], [62, '主任医师'], [68, '主任医师'], [46, '主任医师'],
					                   [20, '医师'], [35, '医士'], [28, '医士'], [33, '医士'], [39, '医士'],
					                   [43, '医师'], [42, '主治医师'], [45, '副主任医师'], [50, '主治医师'], [49,'医士'],
					                   [58, '主治医师'], [54, '医师'], [37, '副主任医师'], [59, '医士'], [64, '主任医师'],
					                   [43, '医师'], [67, '医师'], [70, '副主任医师'], [58, '主任医师'], [89, '主任医师'],
					                   [95, '主任医师'], [58, '副主任医师'], [69, '医士'], [75, '主治医师'], [84, '主任医师'],
					                   [69, '医师'], [47, '主治医师'], [59, '医士'], [26, '医师'], [54, '医师']], 
					    seriesData2 = [[74, '主任医师'], [75, '主任医师'], [13, '主任医师'], [18, '主任医师'], [87, '主任医师'],
						                [61, '主任医师'], [84, '主任医师'], [84, '主任医师'], [75, '主任医师'], [14, '主任医师'],
						                [80, '副主任医师'], [77,'医士'], [92, '主治医师'], [76, '主治医师'], [24, '医师'],
						                [84, '主任医师'], [92, '主任医师'], [71, '主任医师'], [73, '医士'], [26, '医师'],
						                [76, '医师'], [80, '副主任医师'], [72,'医师'], [76, '医师'], [23, '医师'],
						                [19, '医师'], [18, '医师'], [59, '医士'], [57, '主治医师'], [55, '医士'],
						                [70, '副主任医师'], [59, '医士'], [66, '医士'], [26, '医师'], [18, '医师'],
						                [22, '医师'], [70, '主任医师'], [72, '医师'], [53, '医士'], [60, '医士'],
						                [47, '医士'], [68, '医士'], [75, '医师'], [57, '主任医师'], [67, '医士'],
						                [59, '副主任医师'], [75, '主任医师'], [66, '副主任医师'], [76, '主任医师'], [70, '主任医师'],
						                [56, '副主任医师'], [59, '主任医师'], [53, '副主任医师'], [25, '主治医师'], [23, '医士'],
						                [56, '主治医师'], [98,'主治医师'], [68, '副主任医师'], [32, '医士'], [34, '副主任医师'],
						                [28, '医师'], [56,'医士'], [68, '副主任医师'], [46, '主治医师'], [58, '副主任医师'],
						                [37, '主任医师'], [69, '主任医师'], [72, '主任医师'], [45, '副主任医师'], [34, '主治医师']]; 
					var options2 = {
						legendData: ['女性','男性'],
						seriesData: [seriesData1, seriesData2],
						yAxisData : ['主任医师','副主任医师','主治医师','医师','医士'],
				        chartWrapperId: 'c2'
					};
					draw2(w, "医生分析");
					c.scatters(options2);		

					var options3 = {
						seriesName: '全省诊疗人次',
						seriesData:[
					                {value:4849384000, name:'中成药费用'},
					                {value:2695685298, name:'中药费用'},
					                {value:10844227634, name:'西药费用'}],
				        chartWrapperId: 'c3'
					};
					draw3(w, "患者分析");
					c.PNBars(options3);
					break;
				case "常见病":
					var options1 = {
						xAxisData: ['10', '20', '30', '40', '50', '60', '70', '80', '90', '100','110'],
						titles: ['常见病1', '常见病2', '常见病3', '常见病4', '常见病5'],
						seriesData: [[0,30],[0,41],[0,52],[0,63],[0,64],[0,35],[0,65],[0,47],[0,78],[0,49],
					            [1,30],[1,41],[1,52],[1,63],[1,64],[1,35],[1,65],[1,47],[1,78],[1,49],
					            [2,30],[2,41],[2,52],[2,63],[2,64],[2,35],[2,65],[2,47],[2,78],[2,49],
					            [3,30],[3,41],[3,52],[3,63],[3,64],[3,35],[3,65],[3,47],[3,78],[3,49],
					            [4,30],[4,41],[4,52],[4,63],[4,64],[4,35],[4,65],[4,47],[4,78],[4,49]],
					    chartWrapperId: 'c1'
					}
					draw1(w, "常见病");
					c.singleAxisScatters(options1);
					//左侧第二部分
					draw2(w, "近一个月5种高发病");
					var oUl = document.createElement('ul');
						$(oUl).attr('class', 'hyper');
					var lis = '<li>高发病1<span>199999次</span></li>'
								+'<li>高发病2<span>19999次</span></li>'
								+'<li>高发病3<span>18888次</span></li>'
								+'<li>高发病4<span>17777次</span></li>'
								+'<li>高发病5<span>15555次</span></li>';
					$('#c2').append(oUl);
					$('#c2 ul').append(lis);
					
					//左侧第三部分
					draw3(w, "5种常见病");
					var oUl = document.createElement('ul');
						$(oUl).attr('class', 'hyper');
					var lis = '<li>常见病1<span>1342356次</span></li>'
								+'<li>常见病2<span>125425次</span></li>'
								+'<li>常见病3<span>18234次</span></li>'
								+'<li>常见病4<span>17777次</span></li>'
								+'<li>常见病5<span>15555次</span></li>';
					$('#c3').append(oUl);
					$('#c3 ul').append(lis);
					break;
				case "处方总数":
					var options1 = {
						legendData: ['处方数'],
						xAxisData: ['2015','2016'],
						seriesName: ['处方数'],
						seriesData: [225933333, 325933333],
						type: 'bar', //chart的类型： bar, line
						barWidth: '40%',
						chartWrapperId : 'c1'
					};
					draw1(w, "处方数");
					c.barOrLine(options1);
					
					var options2 = {
						seriesName: '处方类型',
						seriesData:[
				                {value:112202760, name:'中成药'},
				                {value:34683454, name:'中药'},
				                {value:179047119, name:'西药'} 
				            ],
				        formatter: "{b} ({d}%) \n \n {c} ",
				        chartWrapperId: 'c2'
					};
					draw2(w, "处方类型");
					c.pie(options2);
					
					var options3 = {
						seriesName: '处方费用类型',
						seriesData:[
					                {value:4849384000, name:'中成药费用'},
					                {value:2695685298, name:'中药费用'},
					                {value:10844227634, name:'西药费用'}],
				        chartWrapperId: 'c3'
					};
					draw3(w, "处方费用类型");
					c.annular(options3);
					
					break;
				case "处方费用":
					var options = {};
					break;
				case "辨证论治开方数":
					var options1 = {
						seriesName: '辨证论治开方数',
						seriesData:[
				                {value:1094, name:'辨证论治开方数'},
				                {value:2310, name:'中药开方数'}//辨证论治开发数/中药开方数
				            ],
				        chartWrapperId: 'c1'
					};
					draw1(w, "辨证论治开方数");
					c.pie(options1);
					
					var options2 = {	//line
						legendData: ['辩证论治数'],
						xAxisData: ['1','2','3','4','5','6','7','8','9','10','11','12'],
						seriesName: ['辩证论治开方数'],
						seriesData: [120, 270, 485, 384, 484, 674, 284, 389, 184, 284, 494, 393],
						type: 'line', //chart的类型： bar, line
						chartWrapperId : 'c2'
					};
					draw2(w, "辩证论治数");
					c.barOrLine(options2);
					
					var options3 = {
							seriesName: '热门处方',
							seriesData:[
						                {name: '处方1',value: 782100},
						                {name: '处方2',value: 885959},
						                {name: '处方3',value: 234558},
						                {name: '处方4',value: 686868},
						                {name: '处方5',value: 437373},
						                {name: '处方6',value: 588869},
						                {name: '处方7',value: 673663}],
					        chartWrapperId: 'c3'
						};
					draw3(w, "热门处方");
					c.rect(options3);
					break;
				case "远程会诊人次":
					var options1 = {
						seriesName: '远程会诊人次',
						seriesData:[
				                {value:3400, name:'远程会诊人次'},
				                {value:5060, name:'总诊疗人次数'}//远程会诊人次/总诊疗人次数
				            ],
				        chartWrapperId: 'c1'
					};
					draw1(w, "远程会诊总人次");
					c.pie(options1);
					
					var options2 = {	//line
						legendData: ['远程会诊人次'],
						xAxisData: ['1','2','3','4','5','6','7','8','9','10','11','12'],
						seriesName: ['远程会诊人次'],
						seriesData: [250, 350, 150, 230, 300, 120, 230, 490, 620, 479, 720, 549],
						type: 'line', //chart的类型： bar, line
						chartWrapperId : 'c2'
					};
					draw2(w, "2016年远程会诊人次");
					c.barOrLine(options2);
					
					var options3 = {
							seriesName: '远程会诊病症',
							seriesData:[
						                {name: '病症1',value: 283},
						                {name: '病症2',value: 384},
						                {name: '病症3',value: 485},
						                {name: '病症4',value: 374},
						                {name: '病症5',value: 576},
						                {name: '病症6',value: 203},
						                {name: '病症7',value: 173},
						                {name: '病症8',value: 373},
						                {name: '病症9',value: 384},
						                {name: '病症10',value: 273}],
					        chartWrapperId: 'c3'
						};
					draw3(w, "远程会诊病症类型");
					c.rect(options3);
					break;
				case "中医体质测评人次":	
					var options1 = {
						seriesName: '中医体质测评总人次',
						seriesData:[
				                {value:2828, name:'中医体质测评总人次'},
				                {value:3160, name:'总诊疗人次数'}//中医体质测评总人次/总诊疗人次数
				            ],
				        chartWrapperId: 'c1'
					};
					draw1(w, "中医体质测评总人次");
					c.pie(options1);
					
					var options2 = {	//line
						legendData: ['中医体质测评总人次'],
						xAxisData: ['1','2','3','4','5','6','7','8','9','10','11','12'],
						seriesName: ['中医体质测评总人次'],
						seriesData: [230, 409, 320, 549, 320, 249, 260, 429, 120, 649, 320, 249],
						type: 'line', //chart的类型： bar, line
						chartWrapperId : 'c2'
					};
					draw2(w, "2016年中医体质测评人次");
					c.barOrLine(options2);
					
					var options3 = {//需要重新考虑
							seriesName: '全省居民体质分布',
							seriesData:[
						                {name: '体质1',value: 60},{name: '体质2',value: 60},
						                {name: '体质3',value: 60},{name: '体质4',value: 60},
						                {name: '体质5',value: 60},{name: '体质6',value: 60},
						                {name: '体质7',value: 60},{name: '体质8',value: 60},
						                {name: '体质9',value: 60},{name: '体质10',value: 60}],
					        chartWrapperId: 'c3'
						};
					draw3(w, "全省居民体质分布");
					c.rect(options3);
					break;
				case "健康信息平台在线人数":	
					var options1 = {
						seriesName: ['健康信息平台在线人数'],
						xAxisData:['平台在线人数','注册总人数'],
						seriesData:[2000,4000],
						type:'bar',//chart的类型： bar, line
						barWidth:'40%',
				        chartWrapperId: 'c1'
					};
					draw1(w, "健康信息平台在线人数");
					c.barOrLine(options1);
					var myChart = echarts.getInstanceByDom(document.getElementById('c1'));
					setInterval(function(){
						myChart.setOption({
			                series: [
			    		        {
			    		        	name:'健康信息平台在线人数',
			    		            data: [Math.floor(Math.random()*1000),2000]
			    		        }]
			            }); 
					},5000);
					
					var options2 = {	//line
						legendData: ['平台在线人数时段分布'],
						xAxisData: ['6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21'],
						seriesName: ['在线人数时段分布'],
						seriesData: [20, 49, 20, 49, 20, 49, 20, 49, 20, 49, 20, 49, 33, 36, 20, 25],
						type: 'line', //chart的类型： bar, line
						chartWrapperId : 'c2'
					};
					draw2(w, "平台在线人数时段分布");
					c.barOrLine(options2);
					
					var options3 = {
							legendData:['电子病历','辨证论治','知识库','远程会诊','远程教育点播','治未病'],
							type:'line',
							stack:'总量',
							xAxisData:['周一','周二','周三','周四','周五','周六','周日'],
							seriesName: ['电子病历','辨证论治','知识库','远程会诊','远程教育点播','治未病'],
							seriesData:[
					                [120, 132, 101, 134, 90, 230, 210],
									[220, 182, 191, 234, 290, 330, 310],
									[150, 232, 201, 154, 190, 330, 410],
									[320, 332, 301, 334, 390, 330, 320],
									[150, 232, 201, 154, 190, 330, 410],
									[123, 231, 234, 135, 241, 213, 178]
						    ],
					        chartWrapperId: 'c3'
						};
					draw3(w, "各子系统访问量");
					c.area(options3);
					break;
				case "资源数据":	
					var options1 = {	//pie
						seriesName: '辨证论治各分类占比',
						seriesData:[
				                {value:1256, name:'方剂'},
				                {value:236, name:'疾病'},
				                {value:1755, name:'证治代表方'},
				                {value:932, name:'症治表'}
				            ],
					        chartWrapperId: 'c1'
						};
						draw1(w, "辨证论治各分类占比");
						c.pie(options1);
					//左2区域
					$('#tcm_left_div_2').empty().append('<div class="news-wapper" id="video_vscroller"></div>');
					$('#video_vscroller').vscroller({ url:'resources/data/video.xml',title: '远程教育视频',scale:0.3});
					
					//右1区域
					$('#tcm_right_div_1').empty().append('<div id="d1_div"><h3 class="tcm-title">资源数据</h3><div id="d1_chart"></div></div>');
					var w = Math.floor(document.body.clientWidth*0.25)-5;
					$('#d1_chart').css({'width':w,'height':w*0.8});
					var options = {	//line
							legendData: ['国家数据','本省数据'],
							yAxisData: ['辨证论治','远程教育','知识库'],
							yType:'category',
							xType:'value',
							seriesName: [['国家数据'],['本省数据']],
							seriesData: [[4179, 191, 12832],[4179, 191, 12832]],
							type: 'bar', //chart的类型： bar, line
							chartWrapperId : 'd1_chart'
						};
						c.barOrLine(options);
						
					var options3 = {
							seriesName: '知识库',
							seriesData:[
					                {value:154, name:'临床指南'},
					                {value:4220, name:'古代方剂'},
					                {value:4051, name:'期刊文献'},
					                {value:58, name:'现代方剂'},
					                {value:4349, name:'名医医案'}
					            ],
						        chartWrapperId: 'c3'
						};
						draw3(w, "知识库");
						c.annular(options3);
						break;
				//信息化	
				case "中医馆所在单位网络":
					//左一区
					var options1 = {
						yData : ['网络'],
						legendData: ['有网络','无网络'],
						seriesName: [['有网络'],['无网络']],
						seriesData: [[1256],[236]],
					    chartWrapperId: 'c1'
						};
						draw1(w, "中医馆所在单位网络");
						c.bar(options1);
						
					//左二区
					var options2 = {	//pie
						seriesName: '网络出口方式分布',
						seriesData:[
				                {value:3858, name:'运营商互\n联网接入'},
				                {value:2759, name:'专线'},
				                {value:1629, name:'ADSL'},
				                {value:774, name:'其他'},
				            ],
					        chartWrapperId: 'c2'
						};
						draw2(w, "网络出口方式分布");
						c.pie(options2);
					
					//左三区
					var options3 = {	//pie
						seriesName: '外部宽带大于10兆',
						seriesData:[
				                {value:126, name:'大于10兆'},
				                {value:236, name:'小于10兆'},
				            ],
					        chartWrapperId: 'c3'
						};
						draw3(w, "外部宽带大于10兆");
						c.annular(options3);
					break;
				case "中医馆所在单位信息化":
					//右1区域
					$('#tcm_right_div_1').empty().append('<div id="d1_div"><h3 class="tcm-title">医院信息管理系统占比</h3><div id="d1_chart"></div></div>');
					var w = Math.floor(document.body.clientWidth*0.25)-5;
					$('#d1_chart').css({'width':w,'height':w*0.8});
					var options1 = {	
						seriesName: '医院信息管理系统',
						cityData:['玉溪市','昆明市','丽江市','临沧市','昭通市','曲靖市','普洱市','保山市','楚雄州','文山州',
						             '德宏州','迪庆州','大理州','红河州','西双版纳','怒江州'],
						progressData:[32,31,34,39,33,35,45,46,19,18,17,10,23,35,54,33],
						legendData:['医院信息管理系统'],
						seriesName:['医院信息管理系统'],
						barWidth:10,
						barHeight:(w*0.8)*0.75,
					    chartWrapperId: 'd1_chart'
					};
					c.progressBar(options1);
					
					var options2 = {
						seriesName2: '依托本地基层医疗卫生信息平台构建医院信息管理系统的中医馆',
						seriesName1: '有医院信息管理系统的中医馆',
						seriesData2: [
		                  {value:235, name:'依托'},
		                  {value:300, name:'不依托'},
		                  {value:810, name:'其他'}
	                    ],
		                seriesData1: [
                          {value:535, name:'有医院信息管理系统'},
                          {value:810, name:'无医院信息管理系统'}
                         ],
				        chartWrapperId: 'c2'
					};
					draw2(w, "有无医院信息管理系统");
					c.nestLoop(options2);
					
					draw1(w, "无");
					draw3(w, "无");
					break;
				case "中医馆信息化":
					var options1 = {
						seriesName:'信息化培训',
						seriesData:[
							{value:355, name:'接受信息化培训的人'},
							{value:280, name:'没接受信息化培训的人'}
				            ],
				        chartWrapperId: 'c1'
					};
					draw1(w, "信息化培训");
					c.pie(options1);
					
					var options2 = {
						seriesName:'电脑数量',
						seriesData:[
							{value:355, name:'安装电脑的中医馆'},
							{value:280, name:'没有安装电脑的中医馆'}
				            ],
				        chartWrapperId: 'c2'
					};
					draw2(w, "电脑数量");
					c.annular(options2);
					
					var options3 = {
						seriesName2: '有医生工作站的中医馆',
						seriesName1: '医生工作站有中医特色',
						seriesData2: [
		                  {value:355, name:'有中医\n特色的'},
		                  {value:280, name:'无中医\n特色的'},
		                  {value:810, name:'其他'}
	                    ],
		                seriesData1: [
                          {value:635, name:'有医生工作\n站的中医馆'},
                          {value:810, name:'无医生工作\n站的中医馆'}
                         ],
				        chartWrapperId: 'c3'
					};
					draw3(w, "医生工作站");
					c.nestLoop(options3);
					break;
			}
		}
		
		//随着导航栏选中的列表改变map的数据
		function changeMapData(url, text) {
			$.ajax({
                url: url,
                type: 'GET',
                dataType: 'xml',
                cache: true,
                success: function (xml) {
    				var mapCharts = $('#tcm_ynMap_div').data('ynMapChart'),
    					mapOption = $('#tcm_ynMap_div').data('ynMapOption'),
    					_data = [], num = 0;
    				//地图添加单击事件
                    if(text=='常见病'){
                    	_data = [{name: '曲靖', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}],selected:true},
           			            {name: '玉溪', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '昆明', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '丽江', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '临沧', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:52}]},
        			            {name: '昭通', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '普洱', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '保山', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '大理', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '楚雄', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '文山', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '德宏', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '迪庆', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '红河', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]},
        			            {name: '西双版纳', value: 15,dis:[{dis1:1,dis2:2,dis3:3,dis4:4,dis5:5}]},
        			            {name: '怒江', value: 40,dis:[{dis1:6,dis2:7,dis3:8,dis4:9,dis5:10}]}];
                    	$('#tcm_right_div_1').empty().append($('<div id="clinic_common_chart"></div>'));
                    	$('#clinic_common_chart').css({'width':300,'height':280});
                    	mapCharts.on('click', function (params) {
                    		var data2 = [], seriesData=[], options = {}, _text = "";
                    		if(params == undefined) {
                    			data2 = _data[0].dis[0];
                    			_text = _data[0].name;
                    		} else {
                    			data2 = params.data.dis[0];
                    			_text = params.data.name;
                    		}
                    	    $.each(data2, function(key) {
                    	        seriesData.push({
                    	        	name:key,
                    	        	value:data2[key]
                    	        });
                    	    });
                    	    options = {
								seriesName: '常见病',
								text: _text,
								roseType: false,
								seriesData: seriesData,
						        chartWrapperId: 'clinic_common_chart'
							};
    						c.pie(options);
                    	});
                    	mapCharts.trigger('click');
                    }else{
                    	$(xml).find('news').each(function () {
                        	var _value = $(this).find('detail').text()?$(this).find('detail').text():0;
                        	_data.push({
                        		name: $(this).find('headline').text(),
                        		value: _value
                        	});
                        	num = num>_value? num: _value;
                        });
                    }
    				
                    mapOption.tooltip.formatter = function(item){
		            	   var itemData = item.data;
		            	   return itemData.name + text + ' :<br> ' + (itemData.value? itemData.value: 0);
		               };
                    mapOption.visualMap.max = num;
                    mapOption.series[0].data = _data;
                    mapCharts.setOption(mapOption);
                }
            });
		}
		
		if(getNav() != 0) {
			//加载导航栏
			$.easing.def = "easeOutBounce";

			$('li.button a').click(function(evt){
				var dropDown = $(this).parent().next();
				$('.dropdown').not(dropDown).slideUp('slow');
				dropDown.slideToggle('slow');
				evt.preventDefault();
			});
			$('li.dropdown li').click(function(evt){
				var aText = this.children[0].childNodes[0].data,
				spanNodeText = this.children[0].children[0].innerText,
				text = aText + (spanNodeText? " : " + spanNodeText: "");
				$('#inner_right_nav .container').find('.li-focus').removeClass('li-focus');
				$(this).addClass('li-focus');
				if(aText == '概况'){
					c.init();
					return;
				}
				var url = getUrl(aText);
				title(aText,spanNodeText);
				leftDiv(text, c, aText);
				rank(url, aText);
				changeMapData(url, aText);
				emptyProgress();
			});
			
		} else {
			return;
		}
	});
})();
